3.1091 \(\int \frac{a+i a \tan (e+f x)}{(c+d \tan (e+f x))^2} \, dx\)

Optimal. Leaf size=75 \[ -\frac{a}{f (d+i c) (c+d \tan (e+f x))}-\frac{i a \log (c \cos (e+f x)+d \sin (e+f x))}{f (c-i d)^2}+\frac{a x}{(c-i d)^2} \]

[Out]

(a*x)/(c - I*d)^2 - (I*a*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((c - I*d)^2*f) - a/((I*c + d)*f*(c + d*Tan[e +
 f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.153505, antiderivative size = 75, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.115, Rules used = {3529, 3531, 3530} \[ -\frac{a}{f (d+i c) (c+d \tan (e+f x))}-\frac{i a \log (c \cos (e+f x)+d \sin (e+f x))}{f (c-i d)^2}+\frac{a x}{(c-i d)^2} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])/(c + d*Tan[e + f*x])^2,x]

[Out]

(a*x)/(c - I*d)^2 - (I*a*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((c - I*d)^2*f) - a/((I*c + d)*f*(c + d*Tan[e +
 f*x]))

Rule 3529

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rubi steps

\begin{align*} \int \frac{a+i a \tan (e+f x)}{(c+d \tan (e+f x))^2} \, dx &=-\frac{a}{(i c+d) f (c+d \tan (e+f x))}+\frac{\int \frac{a (c+i d)+a (i c-d) \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{c^2+d^2}\\ &=\frac{a x}{(c-i d)^2}-\frac{a}{(i c+d) f (c+d \tan (e+f x))}-\frac{(i a) \int \frac{d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(c-i d)^2}\\ &=\frac{a x}{(c-i d)^2}-\frac{i a \log (c \cos (e+f x)+d \sin (e+f x))}{(c-i d)^2 f}-\frac{a}{(i c+d) f (c+d \tan (e+f x))}\\ \end{align*}

Mathematica [B]  time = 2.53238, size = 302, normalized size = 4.03 \[ \frac{(\cos (e)-i \sin (e)) \cos (e+f x) (\cos (f x)-i \sin (f x)) (a+i a \tan (e+f x)) \left (4 \tan ^{-1}\left (\frac{\left (d^2-c^2\right ) \sin (2 e+f x)+2 c d \cos (2 e+f x)}{\left (c^2-d^2\right ) \cos (2 e+f x)+2 c d \sin (2 e+f x)}\right )+\frac{\left (c^2+d^2\right ) \cos (f x) \left (4 f x-i \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )\right )+\left (c^2-d^2\right ) \cos (2 e+f x) \left (4 f x-i \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )\right )-2 d \left (c \sin (2 e+f x) \left (-4 f x+i \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )\right )+2 (d+i c) \sin (f x)\right )}{(c \cos (e)+d \sin (e)) (c \cos (e+f x)+d \sin (e+f x))}\right )}{4 f (c-i d)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])/(c + d*Tan[e + f*x])^2,x]

[Out]

(Cos[e + f*x]*(Cos[e] - I*Sin[e])*(Cos[f*x] - I*Sin[f*x])*(4*ArcTan[(2*c*d*Cos[2*e + f*x] + (-c^2 + d^2)*Sin[2
*e + f*x])/((c^2 - d^2)*Cos[2*e + f*x] + 2*c*d*Sin[2*e + f*x])] + ((c^2 + d^2)*Cos[f*x]*(4*f*x - I*Log[(c*Cos[
e + f*x] + d*Sin[e + f*x])^2]) + (c^2 - d^2)*Cos[2*e + f*x]*(4*f*x - I*Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2
]) - 2*d*(2*(I*c + d)*Sin[f*x] + c*(-4*f*x + I*Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2])*Sin[2*e + f*x]))/((c*
Cos[e] + d*Sin[e])*(c*Cos[e + f*x] + d*Sin[e + f*x])))*(a + I*a*Tan[e + f*x]))/(4*(c - I*d)^2*f)

________________________________________________________________________________________

Maple [B]  time = 0.031, size = 309, normalized size = 4.1 \begin{align*} -{\frac{a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) cd}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}+{\frac{{\frac{i}{2}}a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){c}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}-{\frac{{\frac{i}{2}}a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){d}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}+{\frac{2\,ia\arctan \left ( \tan \left ( fx+e \right ) \right ) cd}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}+{\frac{a\arctan \left ( \tan \left ( fx+e \right ) \right ){c}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}-{\frac{a\arctan \left ( \tan \left ( fx+e \right ) \right ){d}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}-{\frac{ia\ln \left ( c+d\tan \left ( fx+e \right ) \right ){c}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}+{\frac{ia\ln \left ( c+d\tan \left ( fx+e \right ) \right ){d}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}+2\,{\frac{a\ln \left ( c+d\tan \left ( fx+e \right ) \right ) cd}{f \left ({c}^{2}+{d}^{2} \right ) ^{2}}}+{\frac{iac}{f \left ({c}^{2}+{d}^{2} \right ) \left ( c+d\tan \left ( fx+e \right ) \right ) }}-{\frac{ad}{f \left ({c}^{2}+{d}^{2} \right ) \left ( c+d\tan \left ( fx+e \right ) \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e))^2,x)

[Out]

-1/f*a/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*c*d+1/2*I/f*a/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*c^2-1/2*I/f*a/(c^2+d^2)^2*l
n(1+tan(f*x+e)^2)*d^2+2*I/f*a/(c^2+d^2)^2*arctan(tan(f*x+e))*c*d+1/f*a/(c^2+d^2)^2*arctan(tan(f*x+e))*c^2-1/f*
a/(c^2+d^2)^2*arctan(tan(f*x+e))*d^2-I/f*a/(c^2+d^2)^2*ln(c+d*tan(f*x+e))*c^2+I/f*a/(c^2+d^2)^2*ln(c+d*tan(f*x
+e))*d^2+2/f*a/(c^2+d^2)^2*ln(c+d*tan(f*x+e))*c*d+I/f*a/(c^2+d^2)/(c+d*tan(f*x+e))*c-1/f*a/(c^2+d^2)/(c+d*tan(
f*x+e))*d

________________________________________________________________________________________

Maxima [B]  time = 1.51695, size = 243, normalized size = 3.24 \begin{align*} \frac{\frac{2 \,{\left (a c^{2} + 2 i \, a c d - a d^{2}\right )}{\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{2 \,{\left (-i \, a c^{2} + 2 \, a c d + i \, a d^{2}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{{\left (i \, a c^{2} - 2 \, a c d - i \, a d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{2 \,{\left (i \, a c - a d\right )}}{c^{3} + c d^{2} +{\left (c^{2} d + d^{3}\right )} \tan \left (f x + e\right )}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

1/2*(2*(a*c^2 + 2*I*a*c*d - a*d^2)*(f*x + e)/(c^4 + 2*c^2*d^2 + d^4) + 2*(-I*a*c^2 + 2*a*c*d + I*a*d^2)*log(d*
tan(f*x + e) + c)/(c^4 + 2*c^2*d^2 + d^4) + (I*a*c^2 - 2*a*c*d - I*a*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2
*d^2 + d^4) + 2*(I*a*c - a*d)/(c^3 + c*d^2 + (c^2*d + d^3)*tan(f*x + e)))/f

________________________________________________________________________________________

Fricas [A]  time = 1.61944, size = 296, normalized size = 3.95 \begin{align*} \frac{-2 i \, a d -{\left (a c + i \, a d +{\left (a c - i \, a d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (\frac{{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right )}{{\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} +{\left (-i \, c^{3} - c^{2} d - i \, c d^{2} - d^{3}\right )} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

(-2*I*a*d - (a*c + I*a*d + (a*c - I*a*d)*e^(2*I*f*x + 2*I*e))*log(((I*c + d)*e^(2*I*f*x + 2*I*e) + I*c - d)/(I
*c + d)))/((-I*c^3 - 3*c^2*d + 3*I*c*d^2 + d^3)*f*e^(2*I*f*x + 2*I*e) + (-I*c^3 - c^2*d - I*c*d^2 - d^3)*f)

________________________________________________________________________________________

Sympy [B]  time = 19.3384, size = 590, normalized size = 7.87 \begin{align*} \frac{a \left (- i c^{18} - 18 c^{17} d + 153 i c^{16} d^{2} + 816 c^{15} d^{3} - 3060 i c^{14} d^{4} - 8568 c^{13} d^{5} + 18564 i c^{12} d^{6} + 31824 c^{11} d^{7} - 43758 i c^{10} d^{8} - 48620 c^{9} d^{9} + 43758 i c^{8} d^{10} + 31824 c^{7} d^{11} - 18564 i c^{6} d^{12} - 8568 c^{5} d^{13} + 3060 i c^{4} d^{14} + 816 c^{3} d^{15} - 153 i c^{2} d^{16} - 18 c d^{17} + i d^{18}\right ) \log{\left (\frac{c^{2} + d^{2}}{c^{2} e^{2 i e} - 2 i c d e^{2 i e} - d^{2} e^{2 i e}} + e^{2 i f x} \right )}}{f \left (c^{20} - 20 i c^{19} d - 190 c^{18} d^{2} + 1140 i c^{17} d^{3} + 4845 c^{16} d^{4} - 15504 i c^{15} d^{5} - 38760 c^{14} d^{6} + 77520 i c^{13} d^{7} + 125970 c^{12} d^{8} - 167960 i c^{11} d^{9} - 184756 c^{10} d^{10} + 167960 i c^{9} d^{11} + 125970 c^{8} d^{12} - 77520 i c^{7} d^{13} - 38760 c^{6} d^{14} + 15504 i c^{5} d^{15} + 4845 c^{4} d^{16} - 1140 i c^{3} d^{17} - 190 c^{2} d^{18} + 20 i c d^{19} + d^{20}\right )} + \frac{2 a c^{3} d - 6 i a c^{2} d^{2} - 6 a c d^{3} + 2 i a d^{4}}{\left (e^{2 i f x} + \frac{c^{2} + 2 i c d - d^{2}}{c^{2} e^{2 i e} + d^{2} e^{2 i e}}\right ) \left (c^{6} f e^{2 i e} - 6 i c^{5} d f e^{2 i e} - 15 c^{4} d^{2} f e^{2 i e} + 20 i c^{3} d^{3} f e^{2 i e} + 15 c^{2} d^{4} f e^{2 i e} - 6 i c d^{5} f e^{2 i e} - d^{6} f e^{2 i e}\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e))**2,x)

[Out]

a*(-I*c**18 - 18*c**17*d + 153*I*c**16*d**2 + 816*c**15*d**3 - 3060*I*c**14*d**4 - 8568*c**13*d**5 + 18564*I*c
**12*d**6 + 31824*c**11*d**7 - 43758*I*c**10*d**8 - 48620*c**9*d**9 + 43758*I*c**8*d**10 + 31824*c**7*d**11 -
18564*I*c**6*d**12 - 8568*c**5*d**13 + 3060*I*c**4*d**14 + 816*c**3*d**15 - 153*I*c**2*d**16 - 18*c*d**17 + I*
d**18)*log((c**2 + d**2)/(c**2*exp(2*I*e) - 2*I*c*d*exp(2*I*e) - d**2*exp(2*I*e)) + exp(2*I*f*x))/(f*(c**20 -
20*I*c**19*d - 190*c**18*d**2 + 1140*I*c**17*d**3 + 4845*c**16*d**4 - 15504*I*c**15*d**5 - 38760*c**14*d**6 +
77520*I*c**13*d**7 + 125970*c**12*d**8 - 167960*I*c**11*d**9 - 184756*c**10*d**10 + 167960*I*c**9*d**11 + 1259
70*c**8*d**12 - 77520*I*c**7*d**13 - 38760*c**6*d**14 + 15504*I*c**5*d**15 + 4845*c**4*d**16 - 1140*I*c**3*d**
17 - 190*c**2*d**18 + 20*I*c*d**19 + d**20)) + (2*a*c**3*d - 6*I*a*c**2*d**2 - 6*a*c*d**3 + 2*I*a*d**4)/((exp(
2*I*f*x) + (c**2 + 2*I*c*d - d**2)/(c**2*exp(2*I*e) + d**2*exp(2*I*e)))*(c**6*f*exp(2*I*e) - 6*I*c**5*d*f*exp(
2*I*e) - 15*c**4*d**2*f*exp(2*I*e) + 20*I*c**3*d**3*f*exp(2*I*e) + 15*c**2*d**4*f*exp(2*I*e) - 6*I*c*d**5*f*ex
p(2*I*e) - d**6*f*exp(2*I*e)))

________________________________________________________________________________________

Giac [B]  time = 1.50156, size = 252, normalized size = 3.36 \begin{align*} \frac{2 \,{\left (\frac{a \log \left (-i \, \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1\right )}{-i \, c^{2} - 2 \, c d + i \, d^{2}} + \frac{a \log \left ({\left | c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - c \right |}\right )}{2 i \, c^{2} + 4 \, c d - 2 i \, d^{2}} - \frac{a c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 2 i \, a d^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - a c^{2}}{{\left (2 i \, c^{3} + 4 \, c^{2} d - 2 i \, c d^{2}\right )}{\left (c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - c\right )}}\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))/(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

2*(a*log(-I*tan(1/2*f*x + 1/2*e) + 1)/(-I*c^2 - 2*c*d + I*d^2) + a*log(abs(c*tan(1/2*f*x + 1/2*e)^2 - 2*d*tan(
1/2*f*x + 1/2*e) - c))/(2*I*c^2 + 4*c*d - 2*I*d^2) - (a*c^2*tan(1/2*f*x + 1/2*e)^2 - 2*I*a*d^2*tan(1/2*f*x + 1
/2*e) - a*c^2)/((2*I*c^3 + 4*c^2*d - 2*I*c*d^2)*(c*tan(1/2*f*x + 1/2*e)^2 - 2*d*tan(1/2*f*x + 1/2*e) - c)))/f